package org.ccay.async.task.service;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.ccay.async.task.ImportErrorsVO;
import org.ccay.async.task.ImportTaskVO;
import org.ccay.core.base.PageVO;
import org.ccay.core.base.PagedResult;
import org.ccay.core.exception.ApplicationException;

/**
 * task handler service which used by task status mng
 * 
 * @author chaowangbang
 * 
 */
@Path("/import")
@Produces("application/json")
public interface IImportTaskService {

	/**
	 * 查询导入任务表
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVO
	 * @param pageVO
	 * @return
	 * @throws ApplicationException
	 */
	@GET
	@Path("list/page/{pageSize}/{curPage}")
	public PagedResult<ImportTaskVO> findImportTaskList(@QueryParam("") ImportTaskVO importTaskVO,
			@PathParam("") PageVO pageVO) throws ApplicationException;

	/**
	 * 过滤模式
	 * 
	 * @author chaowangbang
	 * @since 2013-9-24
	 * @param importTaskVO
	 * @param pageVO
	 * @return
	 * @throws ApplicationException
	 */
	@GET
	@Path("list/page/{pageSize}/{curPage}/{filterStr}")
	public PagedResult<ImportTaskVO> findImportTaskListFilter(@QueryParam("") ImportTaskVO importTaskVO,
			@PathParam("") PageVO pageVO) throws ApplicationException;

	/**
	 * 查询导入任务表，用于导入监控
	 * 
	 * @author chaowangbang
	 * @since 2013-7-20
	 * @param importTaskVO
	 * @param pageVO
	 * @return
	 * @throws ApplicationException
	 */
	@GET
	@Path("list/page/monitor/{pageSize}/{curPage}")
	public PagedResult<ImportTaskVO> findImportTaskListMonitor(@QueryParam("") ImportTaskVO importTaskVO,
			@PathParam("") PageVO pageVO) throws ApplicationException;

	/**
	 * 根据id查询导入任务
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param id
	 * @return
	 * @throws ApplicationException
	 */
	public ImportTaskVO findImportTaskById(int id) throws ApplicationException;
	
	/**
	 * 根据导入实体查询导入任务
	 * 
	 * @author chaowangbang
	 * @since 2015-06-17
	 * @param importTaskVO
	 * @return
	 * @throws ApplicationException
	 */
	public ImportTaskVO findImportTask(ImportTaskVO importTaskVO) throws ApplicationException;

	/**
	 * 添加一个任务 insertImportTask
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVO
	 * @throws ApplicationException
	 */
	public void createImportTask(ImportTaskVO importTaskVO) throws ApplicationException;

	/**
	 * 更新控制台导入状态 updateImportTaskStatus
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVO
	 * @throws ApplicationException
	 */
	public void updateImportTask(ImportTaskVO importTaskVO) throws ApplicationException;

	/**
	 * 取消一个任务 insert cancelImportTask
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVO
	 * @throws ApplicationException
	 */
	public void cancelImportTask(ImportTaskVO importTaskVO) throws ApplicationException;

	/**
	 * 删除多个任务
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVOs
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/d/list")
	public void deleteImportTaskList(List<ImportTaskVO> importTaskVOs) throws ApplicationException;

	/**
	 * 删除单个任务
	 * 
	 * @author chaowangbang
	 * @since 2011-12-6
	 * @param importTaskVO
	 * @throws ApplicationException
	 */
	public void deleteImportTask(ImportTaskVO importTaskVO) throws ApplicationException;

	/**
	 * 返回任务类型用于下拉框
	 * 
	 * @author chaowangbang
	 * @since 2012-1-16
	 * @return
	 */
	@GET
	@Path("/list")
	public List<ImportTaskVO> findTypeIDDistinct();

	@GET
	@Path("/monitor/list")
	public List<ImportTaskVO> findMonitorTypeIDDistinct();


}
